﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MarkDownFileSplitter.Htm
{
    internal class HtmCatalogTreeItem
    {
        /// <summary>
        /// 在htm文件中的起始位置，用于区分不同层级的标题间的父子关系
        /// </summary>
        public int StartIndex { get; set; }

        /// <summary>
        /// 在htm文件中的终止位置，用于区分不同层级的标题间的父子关系
        /// </summary>
        public int EndIndex { get; set; }

        /// <summary>
        /// 是否为自动填补的节点
        /// </summary>
        public bool IsAutoGenerate { get; set; }

        public string Text { get; set; }

        public int ContainsEndIndex { get;set; }

        public HtmCatalogTreeItem(int startIndex, int endIndex, bool isAutoGenerate, string text, int containsEndIndex)
        {
            StartIndex = startIndex;
            EndIndex = endIndex;
            IsAutoGenerate = isAutoGenerate;
            Text = text;
            ContainsEndIndex = containsEndIndex;
        }

        public HtmCatalogTreeItem(HtmSelectionObject selectionObject, int containsEndIndex)
        {
            StartIndex = selectionObject.StartIndex;
            EndIndex = selectionObject.EndIndex;
            IsAutoGenerate = false; // 默认设置为非自动生成
            Text = selectionObject.Text;
            ContainsEndIndex = containsEndIndex;
        }
    }
}
